Working with Pointer Arrays

Description

Pointer arrays (also called "property arrays") allow you to represent "multi-columned" data in an array. For example, for a customer, you have information about the customer's name, address, phone number etc.

For background, refer to the section on "Dot Variables" in the Xbasic Reference Manual.

Assume that you have the following information about some customers:

images/atable.png

This data can be represented in a pointer array as follows:

DIM customer[3] as P
Customer[1].name = "Alpha"
Customer[1].address = "1 Main St."
Customer[1].city = "Boston"
Customer[1].state = "MA"
Customer[1].zip = "02116"
Customer[1].phone = "6175551212"
Customer[2].name = "Beta"
Customer[2].address = "2 Center St."
Customer[2].city = "New York"
Customer[2].state = "NY"
Customer[2].zip = "01001"
Customer[2].phone = "2125551212"
Customer[3].name = "Gamma"
Customer[3].address = "3 Maple Ln."
Customer[3].city = "Cambridge"
Customer[3].state = "MA"
Customer[3].zip = "02139"
Customer[3].phone = "6178641212"

  • Displaying Data from a Pointer Array in a Dialog Box

  • Displaying Data from a Table

  • Displaying Data from a Table - One Record at a Time

See Also